package com.jnu.accounthelper.db;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class DBHelper extends SQLiteOpenHelper {
    private static final String DATABASE_NAME = "test.db";
    private static final int DATABASE_VERSION = 1;
    public DBHelper(Context context){
        super(context,DATABASE_NAME,null,DATABASE_VERSION);
    }

    @Override
    public void onCreate(SQLiteDatabase db){
        db.execSQL("CREATE TABLE IF NOT EXISTS accounts(_id INTEGER PRIMARY KEY AUTOINCREMENT," +
               " type VARCHAR(10),remark VARCHAR(10), number INTEGER ,CoverResourceId INTEGER,source VARCHAR(10),date VARCHAR(20))");//建表，对数据库进行操作等
        db.execSQL("CREATE TABLE IF NOT EXISTS account_types(_id INTEGER PRIMARY KEY AUTOINCREMENT," +
                " name VARCHAR(10),CoverResourceId INTEGER)");

    }

    @Override
    public void onUpgrade(SQLiteDatabase db,int oldVersion,int newVersion){

    }

}